home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / grabtext.zip / GRABTEXT.C < prev    next >
Text File  |  1990-06-27  |  2KB  |  83 lines

  1. /* a memory resident frame grabber for text screens
  2.    written in MIX POWER C.
  3.  
  4.    By Bill Buckels 1990
  5.  
  6. */
  7.  
  8. #include <bios.h>
  9. #include <stdio.h>
  10. #include <dos.h>
  11.  
  12. #define MED_RES 4
  13. #define HERCULES 99
  14.  
  15. int ADAPTER = MED_RES;
  16. unsigned int HERCBUFFER=0xb000;
  17. int one_count = 0;
  18. int two_count = 0;
  19.  
  20. /* microsoft compatible bsaved format descriptor */
  21. char TEXT_header[7]={
  22.     '\xfd','\x00','\xb8','\x00','\x00','\xA0','\x0F'};
  23.  
  24. void interrupt TEXTPRINT(void)
  25. {
  26.  
  27.  
  28.     FILE *fp;
  29.     static char far *crtptr;
  30.     int i;
  31.     char *filename="IMAGE000.BSV";
  32.  
  33.     disable();
  34.     if(one_count==10){one_count==0;
  35.                        two_count++;
  36.                        if(two_count==10)two_count==0;}
  37.  
  38.     filename[7]=one_count+48;
  39.     filename[6]=two_count+48;
  40.     one_count++;
  41.  
  42.     fp=fopen(filename,"wb");
  43.  
  44.     for(i=0;i<7;i++)fputc(TEXT_header[i],fp);
  45.     if(ADAPTER!=HERCULES)crtptr = MK_FP(0xB800,0);
  46.     else crtptr = MK_FP(HERCBUFFER,0);
  47.     for(i=0;i<4000;i++)fputc(crtptr[i],fp);
  48.     fclose(fp);
  49.     enable();
  50. }
  51.  
  52.  
  53. main(char argc,int *argv[])
  54. {
  55.     unsigned programsize;
  56.  
  57.     if ((biosequip() & 0x30) == 0x30)ADAPTER=HERCULES;
  58.     setvect(5,TEXTPRINT);
  59.     programsize=farsetsize(0);
  60.  
  61.     printf("╔═══════════════════════════════════════════════════╗\n");
  62.     printf("║ GRABTEXT.exe <Ver 1.0>screen GRABBER utility      ║\n");
  63.     printf("║ (C) Copyright by Bill Buckels 1990                ║\n");
  64.     printf("║ THE \"CAMERA\" IS LOADED and ready to take pictures.║\n");
  65.     printf("║ USE THE PRINT SCREEN KEY as the \"CAMERA SHUTTER\"  ║\n");
  66.     printf("╠═══════════════════════════════════════════════════╣\n");
  67.     printf("║ IMAGES will be stored in BSAVED image format in   ║\n");
  68.     printf("║ the current directory starting with \"IMAGE000.BSV\"║\n");
  69.     printf("╠═══════════════════════════════════════════════════╣\n");
  70.     printf("║ These Files may be directly inhaled into THEDRAW  ║\n");
  71.     printf("║ and converted to .ANS there or bloaded from BASIC.║\n");
  72.     printf("║ 25x80 column text mode only is supported.         ║\n");
  73.     printf("╚═══════════════════════════════════════════════════╝\n");
  74.  
  75.     keep(0, programsize);
  76.  
  77. }
  78.  
  79.  
  80.  
  81.  
  82.  
  83.